<template>
  <div>
    <el-form-item
      :label="labelRuleValue.title"
      :prop="propValue"
      class="uploadVideoTag"
    >
      <div class="demo-upload-list">
        <video autoplay :src="value" />
        <div class="demo-upload-list-cover">
          <span @click="getBigContent()">
            <i class="el-icon-zoom-in"></i>
          </span>
        </div>
      </div>
    </el-form-item>
    <el-dialog
      class="videoDialog"
      :append-to-body="true"
      :visible.sync="visible"
      :before-close="handleClose"
    >
      <video autoplay controls :src="value" />
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: "videoTag",
  props: {
    value: {
      type: String, //对应值
      default: "",
    },
    propValue: {
      type: String,
      default: "",
    },
    labelRuleValue: {
      type: Object,
      default: function () {
        return {};
      },
    },
    disabledValue: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      visible: false,
    };
  },
  methods: {
    getBigContent() {
      this.visible = true;
    },
    handleClose() {
      this.visible = false;
    },
  },
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.uploadVideoTag {
  .demo-upload-list {
    display: inline-block;
    width: 200px;
    height: 150px;
    text-align: center;
    line-height: 150px;
    border: 1px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    position: relative;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    margin-right: 4px;

    video {
      width: 100%;
      height: 100%;
    }

    &-cover {
      display: none;
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      background: rgba(0, 0, 0, 0.6);
    }

    &:hover .demo-upload-list-cover {
      display: block;
    }

    &-cover i {
      color: #fff;
      font-size: 20px;
      cursor: pointer;
      margin: 0 2px;
    }
  }
}
</style>